<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>条件判断</title>
    <style>

    </style>
</head>

<body>
    <div id="app">
        <h1 v-if="isshow">{{message}}</h1>
        <h1 v-else>isshow为false显示我</h1>

        <h2 v-if="score>=90">优秀</h2>
        <h2 v-else-if="score>=80">良好</h2>
        <h2 v-else-if="score>=60">及格</h2>
        <h2 v-else>不及格</h2>

        <!-- v-show只是display:none,v-if:false元素不会存在dom中 -->
        <h2 v-show="!isshow">{{message}}show</h2>

        <div>
            <h2>用户登录账号切换</h2>
            <!-- key属性如果不同，表示不复用 -->
            <span v-if="isuser">
                <label for="username">用户账号:</label>
                <input type="text" id="username" placeholder="用户账号" key="username">
            </span>
            <span v-else>
                <label for="email">用户邮箱:</label>
                <input type="text" id="email" placeholder="用户邮箱" key="email">
            </span>
            <button @click="changeloginway">切换类型</button>
        </div>




    </div>
    <script src="./vue.js"></script>
    <script>
        let app = new Vue({
            el: "#app",
            data: {
                message:"你好",
                isshow:true,
                notshow:false,
                score:99,
                isuser:true

            },
            methods: {
                changeloginway(){
                    this.isuser=!this.isuser
                }
            },
            //计算属性
            computed: {

            },
        })

    </script>
</body>

</html>